home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10424 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: yarrina.connect.com.au!usenet
  2. From: Andrew Dalgleish <andrewd@axonet.com.au>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: A question of (lexical) style
  5. Date: Fri, 08 Mar 1996 11:09:20 +1000
  6. Organization: Axon Research, Pty Ltd
  7. Message-ID: <313F88C0.282@axonet.com.au>
  8. References: <313c99bc.0@193.89.47.9>
  9. NNTP-Posting-Host: andrew.axonet.com.au
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (Win95; I)
  14.  
  15. Brian Elgaard wrote:
  16. > A question of (lexical) style
  17. > I am currently writing guidelines for C++ programmers, and I am in doubt about how to place * and & in declarations.
  18. > I prefer to put the type modifier close to the type, such as in:
  19. >   int& Foo()
  20. >   {
  21. >     int* a;
  22. >     int& b = a;
  23. >   }
  24. > This seems natural to me if declarations with modifiers are restricted to declare a single variable.
  25. > [snip]
  26.  
  27. One problem comes from declaring:
  28.  
  29. int*    a,b,c;
  30.  
  31. which is equivalent to:
  32.  
  33. int    *a;
  34. int    b,c;
  35.  
  36. If you apply your "single variable" restriction, you have an exception.
  37. Why do it one way for here, but a different way there?
  38. Consistency is always a good thing (up to a point).
  39.  
  40. -- 
  41. Andrew Dalgleish
  42.